package com.tumblr.logico2012.screens;

import java.util.Vector;
import processing.core.PApplet;
import com.tumblr.logico2012.screens.PopupScreen;

public class PopupManager {

	private PApplet p;
	private Vector<PopupScreen> m_popup;

	public PopupManager(PApplet processor) {
		p = processor;
		m_popup = new Vector<PopupScreen>();
	}
	
	public void init() {
		m_popup.add(new PopupScreen(p, 0 ,"Error"));
		m_popup.add(new PopupScreen(p, 1 ,"Gesture was not completed"));
		m_popup.add(new PopupScreen(p, 2 ,"Blablabllkjsagarror"));
	}
	
	public PopupScreen getPopup(int _id){
		for(PopupScreen pop : m_popup) {
			if (pop.getId()==_id) 
				return pop;	
		}
		return null;
	}
	
	
	public void addPopup (PopupScreen _pop){
		m_popup.add(_pop);
	}
	
		
	public void draw() {
				
		for(PopupScreen pop : m_popup) {
			if (pop.isActive()){
				pop.display();				
			}
		
			
		}

	}
	
	
	
}
